﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Admin_Page.aspx.vb" Inherits="ORS_Cuong.Admin_Page" %>
<%@ Import Namespace="System.Data" %>

    <%@ Register TagName="Sc" TagPrefix="Sc" Src="Script.ascx" %>
<%@ Register TagName="Banner" TagPrefix="Banner" Src="Banner.ascx" %>
<%@ Register TagName="Navigation" TagPrefix="Navigation" Src="Navigation.ascx" %>
<%@ Register TagName="Footer" TagPrefix="Footer" Src="Footer.ascx" %>
  <html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="imagetoolbar" content="no" />
<!-- >Display for all scripts <!-->
<Sc:Sc ID="Sc1" runat="server" />
<script type="text/javascript">
    function getID(clicked_id,caption_text) {
        var btnID = clicked_id;
        document.getElementById("btnHidden").value = btnID;
        document.getElementById("caption_text").value = caption_text;
        document.forms["frmUser"].submit();        
    }
</script>
<title></title>
      <style type="text/css">
          .style1
          {
              width: 54px;
          }
          .style2
          {
              width: 10px;
          }
      </style>
</head>
<body> <!-- >Display for Banner <!-->
<Banner:Banner ID="Banner1" runat="server" />


<div class="main_container">
<Navigation:Navigation runat="server" />

<br /><br /><br />
<span class="title">USER MANAGEMENT</span>

<form id="frmUser" action="Admin_Page.aspx" method="post" runat="server">

<asp:HiddenField ID="btnHidden" runat="server"  Value=""/>
<asp:HiddenField ID="caption_text" runat="server"  Value=""/>

    <div>
    <br /><br /><br />
   <input type="button" id="btnNew" onclick="getID('a','New')" value="Create New User"/>
   <br /><br /><br />
    <table  class="Lecturer_List" style="border-collapse: collapse; margin: 10px 0 0 20px;">
    <tr>
    <th> User ID </th>
    <th> User Name</th>
    <th>Password</th>
    <th class="style1"> Position</th>
    <th>User Type</th>
    <th class="style2">Authorize</th>
    <th> Edit</th>
    </tr>
   
 <%  Dim OutPut As New StringBuilder("")
     Dim strType, strUserID As String
     For Each Me.dr In dt_User.Rows
         strType = dr("User_Admin").ToString
         strUserID = dr("User_Number").ToString
         If strType = "True" And strUserID <> "v000" Then
             strType = "System Admin"
         End If
         If strType = "False" Then
             strType = "Operation User"
         End If
         If strType = "True" And strUserID = "v000" Then
             strType = "Power User"
         End If
        
         OutPut.Clear()%>
      
         
    
        <tr>
        <td><%= dr("User_Number")%>   </td>
        <td><%=dr("User_Name") %> </td>
        <td><%=dr("User_Password") %> </td>
        <td class="style1"><%=dr("User_Position") %> </td>
        <td> <%=strType %></td>
        <td class="style2"> 
        <%  If dr("user_expired") = "True" Then
                
                OutPut.AppendFormat("<input type='button' value='Enable'  onclick=""getID('{0}','{1}');""/>", dr("User_Number"), dr("User_Expired"))
                Response.Write(OutPut)
            Else
                OutPut.AppendFormat("<input type='button' value='Disable'  onclick=""getID('{0}','{1}');""/>", dr("User_Number"), dr("User_Expired"))
                Response.Write(OutPut)
            End If
           
            
            %>
        
        
        </td>
        
        <td>
         <% 
             OutPut.Clear()
             OutPut.AppendFormat("<input type='button' value='Edit'  onclick=""getID('{0}','{1}');""/>", dr("User_Number"), "Edit")
             Response.Write(OutPut)
         %>
                </td>
        </tr>
    <% Next%>
    
    <tr>
    <td colspan="7"> <asp:Label ID="lblMsg" runat="server"></asp:Label></td>
    </tr>
 </table>
  <div> </div>
   
    </div>
    </form>

    <Footer:Footer runat="server" />
</div>
</body>
</html>
